//
//  MineWalletHeaderView.m
//  copyrightTrading
//
//  Created by 郭子一 on 2020/10/6.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import "MineWalletHeaderView.h"

@implementation MineWalletHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{    
    UIView *headerView1 = [UIView new];
    headerView1.backgroundColor = RGB_VALUE(0xDC0000);
    [self addSubview:headerView1];
    [headerView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.top.offset(0);//equalTo(headerView.mas_bottom);
        make.height.mas_equalTo(180);
    }];
    
    self.balanceLabel = [UILabel new];
    self.balanceLabel.text = @"329.00";
    self.balanceLabel.font = JSS_MEDIUM_FONT(42);
    self.balanceLabel.textColor = RGB_VALUE(0xFFFFFF);
    self.balanceLabel.textAlignment = NSTextAlignmentCenter;
    [headerView1 addSubview:self.balanceLabel];
    [self.balanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(20);
        make.left.right.offset(0);
        make.height.mas_equalTo(50);
    }];
    
    UILabel *balanceSubLabel = [UILabel new];
    balanceSubLabel.text = @"当前余额";
    balanceSubLabel.font = JSS_MEDIUM_FONT(17);
    balanceSubLabel.textColor = RGB_VALUE(0xFFFFFF);
    balanceSubLabel.textAlignment = NSTextAlignmentCenter;
    [headerView1 addSubview:balanceSubLabel];
    [balanceSubLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.balanceLabel.mas_bottom);
        make.centerX.offset(0);
        make.width.mas_equalTo(135);
        make.height.mas_equalTo(24);
    }];
    
    self.rechargeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.rechargeBtn setTitle:@"充值" forState:UIControlStateNormal];
    [self.rechargeBtn setTitleColor:RGB_VALUE(0xFFFFFF) forState:UIControlStateNormal];
    [self.rechargeBtn.titleLabel setFont:JSS_MEDIUM_FONT_4];
    self.rechargeBtn.layer.masksToBounds = YES;
    self.rechargeBtn.layer.cornerRadius = 5;
    self.rechargeBtn.backgroundColor = RGB_VALUE(0xFFA700);
    [headerView1 addSubview:self.rechargeBtn];
    [self.rechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.bottom.offset(-10);
//        make.right.offset(-2);
        make.height.mas_equalTo(36);
    }];
    
    self.withdrawBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.withdrawBtn setTitle:@"提现" forState:UIControlStateNormal];
    [self.withdrawBtn setTitleColor:RGB_VALUE(0xFFFFFF) forState:UIControlStateNormal];
    [self.withdrawBtn.titleLabel setFont:JSS_MEDIUM_FONT_4];
    self.withdrawBtn.layer.masksToBounds = YES;
    self.withdrawBtn.layer.cornerRadius = 5;
    self.withdrawBtn.backgroundColor = RGB_VALUE(0x54B700);
    [headerView1 addSubview:self.withdrawBtn];
    [self.withdrawBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.rechargeBtn.mas_right).offset(20);
        make.bottom.offset(-10);
        make.height.mas_equalTo(36);
//        make.right.offset(-37);
        make.width.equalTo(self.rechargeBtn);
    }];
    
    self.bankCardManagerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.bankCardManagerBtn setTitle:@"银行卡管理" forState:UIControlStateNormal];
    [self.bankCardManagerBtn setTitleColor:RGB_VALUE(0xFFFFFF) forState:UIControlStateNormal];
    [self.bankCardManagerBtn.titleLabel setFont:JSS_MEDIUM_FONT_4];
    self.bankCardManagerBtn.layer.masksToBounds = YES;
    self.bankCardManagerBtn.layer.cornerRadius = 5;
    self.bankCardManagerBtn.backgroundColor = RGB_VALUE(0xD5C2AC);
    [headerView1 addSubview:self.bankCardManagerBtn];
    [self.bankCardManagerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.withdrawBtn.mas_right).offset(20);
        make.bottom.offset(-10);
        make.height.mas_equalTo(36);
        make.right.offset(-12);
        make.width.equalTo(self.rechargeBtn);
    }];
    
    self.bandCardBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.bandCardBtn setTitle:@"绑定银行卡账户" forState:UIControlStateNormal];
    [self.bandCardBtn setImage:[UIImage imageNamed:@"右"] forState:UIControlStateNormal];
    [self.bandCardBtn setTitleColor:RGB_VALUE(0xFFFFFF) forState:UIControlStateNormal];
    [self.bandCardBtn layoutButtonWithEdgeInsetsStyle:DVButtonEdgeInsetsStyleRight imageTitleSpace:167];
    [self.bandCardBtn.titleLabel setFont:JSS_MEDIUM_FONT_7];
    [self.bandCardBtn setBackgroundImage:[UIImage imageNamed:@"bandCard"] forState:UIControlStateNormal];
    [self addSubview:self.bandCardBtn];
    [self.bandCardBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(19);
        make.top.equalTo(headerView1.mas_bottom).offset(10);
        make.height.mas_equalTo(51);
        make.right.offset(-19);
    }];
}
@end
